package com.oig.sys.auth.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

@Data
public class ResourceDataCfgVo {

    @Schema(description = "主键id")
    private Integer id;

    @Schema(description = "所属菜单id")
    private Integer resourceId;

    @Schema(description = "限定用户范围类型：0-按角色限定 1-按岗位限定 2-按部门限定")
    private String userRelationType;

    @Schema(description = "限定用户范围关联id")
    private Integer userRelationId;

    @Schema(description = "数据过滤类型：0-按用户id匹配 9-自定义sql")
    private String dataEqType;

    @Schema(description = "数据过滤类型=0时填写，用户id对应的字段 从资源数据列表里选择column_field")
    private String dataEqFiled;

    @Schema(description = "限定值或sql模板 type=1时填值，type=9时填条件sql")
    private String dataEqSql;

    @Schema(description = "限定用户开放权限白名单,格式：[{\"id\":\"1\",\"name\":\"admin\"}]")
    private String whitelist;

    @Schema(description = "无权限列，json数组格式[\"c1\",\"c2\"]")
    private String excludeField;

    @Schema(description = "状态")
    private String status;

    @Schema(description = "租户id")
    private Integer tenantId;
    @Schema(description = "租户编码")
    private String tenantCode;
    @Schema(description = "租户名称")
    private String tenantName;

    @Schema(description = "创建人")
    private String createUserName;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "创建时间")
    private Date createTime;

    @Schema(description = "最后更新人")
    private String lastUpdateName;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "最后更新时间")
    private Date lastUpdateTime;


    public ResourceDataCfgVo(){}

    public ResourceDataCfgVo(Integer id, Integer resourceId, String userRelationType, Integer userRelationId,
                             String dataEqType, String dataEqFiled, String dataEqSql, String whitelist, String excludeField){
        this.id = id;
        this.resourceId = resourceId;
        this.userRelationType = userRelationType ;
        this.userRelationId = userRelationId;
        this.dataEqType = dataEqType;
        this.dataEqFiled = dataEqFiled ;
        this.dataEqSql = dataEqSql ;
        this.whitelist = whitelist ;
        this.excludeField = excludeField;
    }

    public ResourceDataCfgVo(Integer id, Integer resourceId, String userRelationType, Integer userRelationId,
                             String dataEqType, String dataEqFiled, String dataEqSql, String whitelist, String excludeField,
                             String status, Integer tenantId,String tenantCode,String tenantName,
                             String createUserName, Date createTime, String lastUpdateName, Date lastUpdateTime){
        this.id = id;
        this.resourceId = resourceId;
        this.userRelationType = userRelationType ;
        this.userRelationId = userRelationId;
        this.dataEqType = dataEqType;
        this.dataEqFiled = dataEqFiled ;
        this.dataEqSql = dataEqSql ;
        this.whitelist = whitelist ;
        this.excludeField = excludeField;
        this.status = status;
        this.tenantId = tenantId;
        this.tenantCode =tenantCode;
        this.tenantName = tenantName;
        this.createUserName = createUserName;
        this.createTime = createTime;
        this.lastUpdateName = lastUpdateName;
        this.lastUpdateTime = lastUpdateTime;
    }

}
